import java.io.*;

public class BufferedStreamDemo {
    public static void main(String[] args) throws IOException {

        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("MyFile\\src\\tmp\\bis.txt"));
        bos.write("Hello".getBytes());
        bos.write("\n".getBytes());
        bos.write("World".getBytes());
        bos.close();

        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("MyFile\\src\\tmp\\bis.txt"));
        byte[] bts = new byte [1024];
        int len;
        while((len = bis.read(bts)) != -1)
            System.out.println(new String(bts,0,len));
        bis.close();
    }
}
